package com.lft01.thread;

/**
 * Function: ADD FUNCTION. Reason: ADD REASON. Date 2020/6/5 19:54
 *
 * <p>Class Name: Test2 Package Name: com.lft.thread
 *
 * @author Laifengting
 * @version 1.0.0
 * @since JDK 8
 */
public class Test3 {
	public static void main(String[] args) {
		MyTicketForLock myTicket = new MyTicketForLock();
		
		for (int i = 0; i < 5; i++) {
			// 执行卖票任务
			new Thread(new Runnable() {
				@Override
				public void run() {
					myTicket.sale();
				}
			}, "消费者Lock锁线程i" + i).start();
		}
		
		for (int j = 0; j < 5; j++) {
			new Thread(() -> {
				myTicket.sale();
			}, "消费者Lock锁线程j" + j).start();
		}
	}
}
